<?php
namespace app\admin\model;

use think\Model;
                    

class User extends Model
                    
{
                    
    public function getAll($where = ''){
                    
        $rs = User::where($where)

            ->paginate(10);
                    
        return $rs;
                    
    }

    public function getAllPage($where = ''){

        $rs = User::where($where)

            ->paginate(10);

        return $rs;

    }
                    
    public function getOne($where){
                    
        $rs = User::where($where)
                    
        ->find();
                    
        return $rs;
                    
    }
                    
    public function add($data){
                    
        $rs = User::data($data)
                    
        ->save();
                    
        return $rs;
                    
    }
                    
    public function edit($where,$data){
                    
        $rs = User::where($where)
                    
        ->update($data);
                    
        return $rs;
                    
    }
                    
    public function del($where){
                    
        $rs = User::where($where)
                    
        ->delete();
                    
        return $rs;
                    
    }

    public function totalNum(){
        $rs = User::count('id');
        return $rs;
    }

    public function totalNumWhere($where){
        $rs = User::where($where)
            ->count('id');
        return $rs;
    }
}
                    
